import { handleData } from '@/util/data'
import { post } from '@http/index'

const config = [
  ['id', 'url', 'icon', 'lang_key', 'name', 'items'],
  ['id', 'route', 'icon', 'langkey', 'name', 'children']
]

//token
//c_id
export const getMenuData = async (...args) => {
  const { code, data, cancelMessage } = await post('/getMenuList', ...args)
  if (data)
    return {
      code,
      data: handleData(data, config),
      cancelMessage
    }

  return { code, cancelMessage }
}
